package com.chance.cc.crawler.development.command.trigger.domain.cnhubei;

import com.chance.cc.crawler.core.downloader.HttpPage;
import com.chance.cc.crawler.development.command.trigger.domain.vm.commentCrawlerTriggerInfo;
import com.chance.cc.crawler.meta.core.bean.CrawlerMetaConstant;

/**
 * @Author Zhao.Hhuan
 * @Date Create in 2021/3/11 18:24
 * @Description
 *      东湖社区 采集trigger
 **/
public class CnHubeiCrawlerTriggerInfo extends commentCrawlerTriggerInfo {

    public static void simpleCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey,String domain,String node) {
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Simple,
                "",
                node + "临时采集任务"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    public static void realtimeCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey,String domain,String node) {
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 0/2 * * ?",
                node + "实时采集任务，每两个小时采集一次"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }

    public static void traceCrawlerScheduleTriggerInfo(String crawlerKey,String crawlerTriggerKey,String domain,String node) {
        HttpPage httpPage = crawlerJobTriggerCommand.addOrUpdateScheduleCrawlerTrigger(
                crawlerKey,
                crawlerTriggerKey,
                domain,
                CrawlerMetaConstant.ScheduleJobTrigger_Cron,
                "0 0 4 * * ?",
                node + "回溯7天采集任务，每天凌晨4点开始采集"
        );
        System.out.println("添加采集调度信息：" + httpPage.getRawText());
        System.out.println("triggerKey: " + crawlerTriggerKey);
    }
}
